/**
 * promise 形式 showModal
 * @param {object} param0 
 */
export const showModal = ({content})=>{
  return new Promise((resolve,reject)=>{
    wx.showModal({
      content: content,
      success: (result) => {
        resolve(result)
      },
      fail:(err) =>{
        reject(err)
      }        
    })
  })
}

/**
 *  封装 授权 请求
 */
export const getSetting = ()=>{
  return new Promise((resolve,reject) => {
    wx.getSetting({
      success: (result)=>{
        resolve(result)
      },
      fail: (error)=>{
        reject(error)
      }
    })
  })
}
/**
 * 封装 获取收货地址
 */
export const chooseAddress = () =>{
  return new Promise((resolve,reject) => {
    wx.chooseAddress({
      success: (result) => {
        resolve(result)
      },
      fail: (error) => {
        reject(error)
      }
    })      
  })
}
/**
 * 
 */
export const openSetting = () =>{
  return new Promise((resolve,reject) => {
    wx.openSetting({
      success: (result)=>{
        resolve(result)
      },
      fail: (error)=>{
        reject(error)
      }
    })
  })
}

export const showToast = ({title}) => {
  return new Promise((resolve,reject) => {
    wx.showToast({
      title: title,
      icon: 'none',
      mask: true,
      success: (result) => {
        resolve(result)
      },
      fail: (error) => {
        reject(error)
      }
    });
      
  })
}
